home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
031-040
/
amok39
/
datatoobj
/
readme
< prev
next >
Wrap
Text File
|
1993-11-04
|
2KB
|
69 lines
DataToObject
Program to convert raw data files into object modules
Written by Werner Gunther
Public Domain
Normally, when you need to access data (sprites, image data, a long text)
from C or from assembler, you have to convert your data file into source
statements or load them into memory on runtime. Using this utility you may
create a object file from your data file and just link program and data
together.
SYNTAX:
DataToObject [datafile] [objectfile] [variablename] [-c] [-f]
where:
datafile is the file containing your data,
objectfile is the file to be created,
variablename the name of the variable you intent to use to access the data,
-c if the data has to be loaded into CHIP-Ram,
-f if the data has to be loaded into FAST-Ram.
If a parameter is missing, the program has been called from Workbench or an
error occured during execution, you will get a requester to enter/modify your
parameters.
The resulting object file contains another variable named variablename+'len'
(i.e. '_test' would produce '_testlen'), where the length of your data is
stored (the variable is a long int, the size is in bytes).
Short example how to access your data from C and asm:
Suppose you have written a long text with your favorite editor (DME) and
filed under the name 'text'.
Now call this program:
DataToObject text text.obj _text
This should produce a file called text.o.
The C source to print out your text may look like this:
extern char text;
extern long textlen;
main()
{
Write(Output(),&text,textlen);
}
Same in assembler:
XREF _text
XREF _textlen
XREF _DOSBase
XREF _LVOOutput
XREF _LVOWrite
move.l _DOSBase,a6
jsr _LVOOutput(a6)
move.l #_text,d2
move.l _textlen,d3
jmp _LVOWrite(a6)
END
Now the bad news: It does not work with Lattice C!
Werner Gunther (g35@DHDURZ1.BITNET)